﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <%= TempData["Message"]%>
    <div id="cactionbutton">
        <button type="button" id="btnRefesh" title="Refesh" class="button refresh">
            Làm mới</button>
        <button type="button" id="btnDelete" title="Delete" class="button delete">
            Xóa</button>
        <button type="button" id="btnAddnew" title="Refesh" class="button addnew">
            Tạo mới</button>
    </div>
    <div id="cfilter">
        <table border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td>
                    <input type="text" id="txtKeyword" value="<%= Constants.CATEGORY_NAME%>" onfocus="ShowOnFocus(this,'<%= Constants.CATEGORY_NAME  %>')"
                        onblur="ShowOnBlur(this,'<%= Constants.CATEGORY_NAME  %>')" />
                </td>
                <td>
                    <%=Html.DropDownList(CommonDataKey.CATEGORY, ViewData[CommonDataKey.CATEGORY] as SelectList, Constants.PARENT_CATEGORY_FIRST_ITEM, new { @style = "width:180px" })%>
                </td>
                <td>
                    <button type="button" id="btnFilter" title="Filter" class="button filter">
                        Lọc</button>
                </td>
            </tr>
        </table>
    </div>
    <div class="clist">
        <table id="list" class="scroll">
        </table>
        <div id="pager" class="scroll" style="text-align: center;">
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PageTitle" runat="server">
    Thẻ sinh viên - Danh mục
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
    <script src="/Scripts/jquery.validate.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            jQuery("#list").jqGrid({
                url: '/Administration/Category/GetListJQGrid/?name=' + encodeURIComponent($("#txtKeyword").val()) + '&categoryId=' + $("#<%=CommonDataKey.CATEGORY%>").val(),
                datatype: 'json',
                mtype: 'GET',
                colNames: ['ID', 'Hình', 'Tên Danh Mục', 'Mô Tả','Thứ Tự','Chức Năng'],
                colModel: [
                  { name: 'ID', index: 'ID', align: "center", width: 50, hidden: true },
                  { name: 'Image', index: 'Image', align: "center", width: 50, sortable: false },
                  { name: 'CategoryName', index: 'CategoryName', align: "left", width: 100, sortable: true },
                  { name: 'Description', index: 'Description', align: "left", width: 200, sortable: false },
                  { name: 'CategoryOrder', index: 'CategoryOrder', align: "center", width: 50, sortable: false },
                  { name: 'Action', index: 'Action', editable: false, width: 40, align: 'center', sortable: false}],
                pager: jQuery('#pager'),
                rowList: [20, 30, 50, 100, 200],
                sortname: 'CategoryOrder',
                sortorder: "asc",
                multiselect: true,
                viewrecords: true,
                width: 800, height: "100%",
                imgpath: '/scripts/grid/themes/basic/images',
                loadui: 'block'
            });
            JS_LIB.onEnterKeyword();
            $("#btnAddnew").click(function () {
                JS_LIB.redirect('/Administration/Category/Create');
            });
            $("#btnRefesh").click(function () {
                window.location = "/Administration/Category/Index";
            });
            $("#btnDelete").click(function () {
                JS_LIB.deletes('#list', 'ID', '/Administration/Category/DeleteList');
            });
            $("#btnFilter").click(function () {
                $('#list').setGridParam({ url: '/Administration/Category/GetListJQGrid?name=' + encodeURIComponent($('#txtKeyword').val()) + '&categoryId=' + $("#<%=CommonDataKey.CATEGORY%>").val() });
                $("#list").trigger('reloadGrid');
            });
        });
    </script>
    <style type="text/css">
        .ui-jqgrid tr.jqgrow td
        {
            white-space: normal;
        }
    </style>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ModuleName" runat="server">
    
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="FunctionTitle" runat="server">
    Danh Mục
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="LoginRoles" runat="server">
</asp:Content>
